import pandas as pd
pd.set_option('display.unicode.east_asian_width',True)
df = pd.read_excel('互联网广告智能投放数据.xlsx')
df['投放时间'] = pd.to_datetime(df['投放时间']).dt.hour
df1 = df.groupby('渠道').agg({'价格(元)':'sum'})
df1['排名'] =df1.rank(method='first',ascending=False)
df1.sort_values(by='排名',)